import request from '@/utils/request';

export const login = (data) => {
    return request({
        url: '/user/login',
        method: 'post',
        data: data,
        headers: { 'Content-Type': 'application/json' }
    });
}

export function getUserInfo(userId) {
    return request({
        url: `/user/${userId}`,
        method: 'get'
    });
}

export function updateUserInfo(userInfo) {
    return request({
        url: `/user/${userInfo.userId}`,
        method: 'put',
        data: userInfo
    });
}

export function changePassword(userId, passwordData) {
    return request({
        url: `/user/${userId}/password`,
        method: 'post',
        data: passwordData
    });
}